﻿#pragma once

#include <QCloseEvent>
#include <QDateTime>
#include <QMainWindow>

QT_BEGIN_NAMESPACE
namespace Ui {
class MainWindow;
}
QT_END_NAMESPACE

class MainWindow : public QMainWindow {
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
    void setVpnInfo(QString serverAddress, QString hubName, QString username, QString vpnIP, QDateTime connectTime);
    void setNeedExit(bool needExit);

signals:
    void needLogout();

protected:
    void closeEvent(QCloseEvent *event) override;
private slots:
    void on_btnLogout_clicked();
    void updateConnectionDuration();

private:
    Ui::MainWindow *ui;
    QTimer *m_timer;
    QDateTime m_connectTime;
    bool m_needExit;
};
